xend: allow a device to be assigned to a guest and its stubdom
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 14 Oct 2009 07:56:25 +0000 (08:56 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 14 Oct 2009 07:56:25 +0000 (08:56 +0100)
This patch allows a pci device to be passed through an HVM guest and
its own stubdom at the same time.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
tools/python/xen/xend/XendConfig.py
tools/python/xen/xend/server/pciif.py

index 347639920edd0c0aa6e52015b03cd606301a1502..50b7afad41d570d6d8fd3caf24ef6172824d5c16 100644 (file)
@@ -2063,6 +2063,9 @@ class XendConfig(dict):
     def is_hvm(self):
         return self['HVM_boot_policy'] != ''
 
+    def is_stubdom(self):
+        return (self['PV_kernel'].find('ioemu') >= 0)
+
     def target(self):
         return self['target']
 
index b56cf3b650a3546a509ee1b1c511215157ab305f..3d1f7b27c32b749cf40eed7f37a563d1cc3c5afa 100644 (file)
@@ -77,7 +77,8 @@ def get_all_assigned_pci_devices():
     dom_list = xstransact.List('/local/domain')
     pci_str_list = []
     for d in dom_list:
-        pci_str_list = pci_str_list + get_assigned_pci_devices(int(d))
+        if xstransact.Read('/local/domain/' + d + '/target') is None :
+            pci_str_list = pci_str_list + get_assigned_pci_devices(int(d))
     return pci_str_list
 
 class PciController(DevController):
@@ -303,7 +304,7 @@ class PciController(DevController):
         if dev.driver == 'pciback':
             PCIQuirk(dev)
 
-        if not self.vm.info.is_hvm():
+        if not self.vm.info.is_hvm() and not self.vm.info.is_stubdom() :
             # Setup IOMMU device assignment
             bdf = xc.assign_device(fe_domid, pci_dict_to_xc_str(pci_dev))
             pci_str = pci_dict_to_bdf_str(pci_dev)